package ncs.common.action;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import ncs.common.model.RSLogin;

import com.alibaba.fastjson.JSON;
import com.opensymphony.xwork2.ActionSupport;

public class Login extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private String jsonResult;
	private String username;
	private String password;
	private String safecode;
	public String getSafecode() {
		return safecode;
	}
	public void setSafecode(String safecode) {
		this.safecode = safecode;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	private InputStream jsonStream;
	public InputStream getJsonStream() throws Exception {
		jsonStream=new ByteArrayInputStream(jsonResult.getBytes("UTF-8"));
		return jsonStream;
	}
	public void setJsonStream(InputStream jsonStream) {
		this.jsonStream = jsonStream;
	}
	@Override
	public String execute() throws Exception {
		System.out.println(username);
		System.out.println(password);
		RSLogin rs=new RSLogin(false,"erroe test");
		jsonResult=JSON.toJSONString(rs);
		System.out.println(jsonResult);
		return SUCCESS;
	}
}
